﻿<link href="@Url.Content("~/content/activitie_detail.css")" rel="stylesheet" type="text/css" />

@model List<PessMvc.Models.ExpertJudgeModel>

@{
    var grid = new WebGrid(Model,rowsPerPage:50);
}

<style type="text/css">
    .col1 {width:70px !important;}
    .col2 {width:120px !important;}
    .col3 {width:60px;text-align:center !important;}
    .col4 {width:150px;text-align:right !important;}
    .col5 {width:130px;text-align:right !important;}
    .col6 {width:220px !important;text-align:center !important;}
    .col7 {width:60px !important;}
    .col8 {width:80px;}
    .col9 {width:80px;}
    .thAction {
        width: 40px !important;
        max-width: 40px !important;
        border-left: none !important;
        border-right: none !important;
    }
</style>

<div id="m-title">
    <h2>评委库</h2>
    <h3>@ViewBag.ErrorMessage</h3>
    <div id="m-op" class="f-bow">

        @using (Html.BeginForm("AddExpertJudges2", "ExpertJudge", FormMethod.Post, new { enctype = "multipart/form-data" }))
        {
        @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
                @Html.ActionLink(" 下载评委模版", "Download", "Home", new { filename = "expert_template.xls" }, new { @class="u-btn-a f-btn-long2"}) <span>&#8195;</span>
                <div class="u-uf u-uf-pw"><input type="file" name="file" class="fileNew" id="fileNew" onchange="document.getElementById('textNew').value=this.value" /></div>
                <input type="text" name="textNew" id="textNew" class="u-it textNew" readonly="true" />
                <input type="button" class="u-btn btnNew" value="浏览" />
                <input type="submit" value="上传" class="u-btn" />

}
        @using (Html.BeginForm("ExportToExcel2", "ExpertJudge", FormMethod.Post))
        {
            //Consider put keyword value here.
            @Html.Hidden("keyword", null)
            <input type="submit" value="下载评委名单Excel" class="u-btn f-btn-long2" />
        }

        @Html.ActionLink("创建评委", "CreateExpertJudge", "ExpertJudge")

    </div>
</div>

<fieldset>
    <div style="padding-bottom:10px;">
        @using (Html.BeginForm("ExpertJudges", "ExpertJudge", FormMethod.Post))
        {
            @Html.TextBox("keyword", null, new { @class = "u-it",style="width:150px;" })
            <input type="submit" value="查询" class="u-btn" />
        }
       
    </div>
    <div><h3>@ViewBag.ErrorMessage</h3></div>
    @using (Html.BeginForm("ResetPassword", "ExpertJudge"))
{
    <div id="ResetPassword">
        @Html.TextBox("Password", null, new { @class = "u-it", style = "width:150px;" })
        <input type="submit" value="重置密码" class="u-btn" />
    </div>
    @grid.GetHtml(columns: grid.Columns(
            grid.Column(header: "□", style: "u-chk-th", format: @<text><input name="expertSN" type="checkbox" value="@item.SerialNumber" /></text>),
    grid.Column("SerialNumber", header: "评委编号", style:"col1"),
    grid.Column("RealName", header: "真实姓名", style:"col2"),
    grid.Column("Gender", header: "性别", style:"col3", format: @<text>@Utility.TranslateGender(item.Gender)</text>),
            grid.Column("Birthdate", header: "出生年月", style: "col4"),
            grid.Column("Phone", header: "电话", style: "col5"),
            grid.Column("ContactAddress", header: "通讯地址", style: "col6"),
            grid.Column("ZipCode", header: "邮政编码", style: "col5"),

            grid.Column(format: (item) => Html.ActionLink("编辑", "EditExpertJudge", "ExpertJudge", new { SerialNumber = item.SerialNumber, returnUrl = HttpContext.Current.Request.RawUrl }, null), header: "", style: "thAction"),
            grid.Column(format: (item) => Html.ActionLink("删除", "Delete", "ExpertJudge", new { SerialNumber = item.SerialNumber, returnUrl = HttpContext.Current.Request.RawUrl }, null), header: "", style: "thAction")
    ))
}
</fieldset>


<script language="javascript">
    function chk_select() {
        for (i = 0; i < document.getElementsByClassName("u-chk-th").length; i++) {
            if (document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].getElementsByTagName("input")[0].checked) {
                document.getElementsByClassName("u-chk-th")[i].getElementsByTagName("input")[0].checked = true;
            } else {
                document.getElementsByClassName("u-chk-th")[i].getElementsByTagName("input")[0].checked = false;
            }
        }
    }
    function chk_click() {
        tmp = 0;
        for (i = 0; i < document.getElementsByClassName("u-chk-th").length; i++) {
            if (document.getElementsByClassName("u-chk-th")[i].getElementsByTagName("input")[0].checked) {
                tmp++
            }
        }
        if (tmp == document.getElementsByClassName("u-chk-th").length) {
            document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].getElementsByTagName("input")[0].checked = true;
        }
        else {
            if (tmp == 0) {
                document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].getElementsByTagName("input")[0].checked = false;
            }
        }
    }
    document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].onclick = chk_select;
    document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].innerHTML = "<input type='checkbox' name='fly-chk' id='fly-chk'>";//"选中/取消选中";
    for (j = 0; j < document.getElementsByClassName("u-chk-th").length; j++) {
        document.getElementsByClassName("u-chk-th")[j].getElementsByTagName("input")[0].onclick = chk_click;
    }
</script>